﻿@model Lehnet.Models.MusteriAdres
<html>
<head>
    @{Html.RenderPartial("FancyRequireScripts");}
    <script>
        $(document).ready(function () {
            $("#drpIller").change(function () {
                GetIlcelerAjax();
            });
            GetIlcelerAjax();
        });
        function GetIlcelerAjax() {
            var ilId = $("#drpIller").val();
            $.ajax({
                url: '/MusteriAdresi/GetIlcelerAjax',
                data: {
                    ilId: ilId
                },
                dataType: 'json',
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                    var jsonData = eval(data);
                    $("#drpIlceler").children().remove();
                    $.each(jsonData, function (index, itemData) {
                        $("#drpIlceler").append("<option value='" + itemData.Id + "'>" + itemData.Ad + "</option>");
                    });
                }
            });
        }


    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
        <h2>@ViewBag.Message</h2> 
        <fieldset>
            <legend>Müşteri Adres Kaydı</legend>
            @Html.HiddenFor(p => p.Id)
            @Html.HiddenFor(p => p.MusteriId)
            <table width="100%">
                <tr>
                    <td>Adres</td>
                    <td>:</td>
                    <td>@Html.TextAreaFor(model => model.Adres)</td>
                </tr>
                <tr>
                    <td>Açıklama</td>
                    <td>:</td>
                    <td>@Html.EditorFor(model => model.Aciklama)</td>
                </tr>
                <tr>
                    <td>İlgili Kişi</td>
                    <td>:</td>
                    <td>@Html.EditorFor(model => model.IlgiliKisi)</td>
                </tr>
                <tr>
                    <td>İl</td>
                    <td>:</td>
                    <td>@Html.DropDownListFor(m => m.IlId, new SelectList(@ViewBag.SehirList, "Id", "Ad"), new { id = "drpIller" }) </td>
                </tr>
                <tr>
                    <td>İlçe</td>
                    <td>:</td>
                    <td>
                        <select style="width: 150px;" data-val="true" data-val-number="The field IlId must be a number." data-val-required="The IlId field is required." id="drpIlceler" name="IlceId" />

                    </td>
                </tr>
                <tr>
                    <td>Şifre</td>
                    <td>:</td>
                    <td>
                        <select style="width: 150px;" name="AdresTip">
                            <option value="1">Yükleme Adresi</option>
                            <option value="2">Boşaltma Adresi</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>İlgili Kişi</td>
                    <td>:</td>
                    <td>@Html.TextBoxFor(m => m.IlgiliKisi) </td>
                </tr>
                <tr>
                    <td>Aktif mi?</td>
                    <td>:</td>
                    <td>@Html.CheckBoxFor(model => model.Aktif)</td>
                </tr>
                <tr>
                    <td colspan="6">
                        <input type="submit" value="Kaydet" /></td>

                </tr>
            </table>
        </fieldset>
    }

    <div>
        @Html.ActionLink("Listeye geri dön", "Index", new { id = @Model.MusteriId })
    </div>

</body>
</html>


